#include "RessourceManager.h"
#include <iterator>

sf::Texture* RessourceManager::getTexture(std::string s)
{
    return (loadedTextures.count(s) ? loadedTextures[s] : loadTexture(s));
}

sf::Texture* RessourceManager::loadTexture(std::string s)
{
    loadedTextures[s] = new sf::Texture();
    loadedTextures[s]->loadFromFile(s);
    return loadedTextures[s];
}

sf::Font* RessourceManager::getFont(std::string s)
{
    return (loadedFonts.count(s) ? loadedFonts[s] : loadFont(s));
}

sf::Font* RessourceManager::loadFont(std::string s)
{
    loadedFonts[s] = new sf::Font;
    loadedFonts[s]->loadFromFile(s);
    return loadedFonts[s];
}

std::map<std::string, sf::Texture*> RessourceManager::loadedTextures;
std::map<std::string, sf::Font*> RessourceManager::loadedFonts;
